package
{

import flash.display.*;
import flash.utils.Dictionary;

public class Draw extends Object
{
	private var main:DisplayObjectContainer;
	private var pens:Dictionary;
	
	public function Draw(main:DisplayObjectContainer)
	{
		this.main=main;
		pens=new Dictionary();
	}
	
	public function render(item:*,pen:Graphics):void{
		item.draw(pen);
	}
	
	public function getNewLayer(top:Boolean=true):Sprite{
		
		var s:Sprite=new Sprite();
		
		if(top)main.addChild(s);
		else main.addChildAt(s,0);
		
		pens[s]=s.graphics;
		return s;
	}
	
	public function getPen(s:DisplayObjectContainer):Graphics{
		return pens[s];
	}
	
}

}

